package lab01;

import java.util.Scanner;

/**
 * Created by 林云志 on 2017/10/13.
 */
public class Test12 {
    public static void main(String[] args) {
        System.out.println("请输入一个1-9999的数");
        Scanner sc = new Scanner(System.in);
        int number=sc.nextInt();
        int n;
        int unit = number%10;
        int ten = number/10%10;
        int hundred = number/100%10;
        int thousand = number/1000;
        if (thousand !=0){
            n = 4;
            System.out.println("这是一个"+n+"位数");
            if (thousand==unit&&ten==hundred){
                System.out.println("这个数"+number+"是回文");
            }else System.out.println("这个数"+number+"不是回文");

        }else if (hundred !=0){
            n=3;
            System.out.println("这是一个"+n+"位数");
            if (hundred==unit){
                System.out.println("这个数"+number+"是回文");
            }else System.out.println("这个数"+number+"不是回文");
        }else if (ten!=0){
            n=2;
            System.out.println("这是一个"+n+"位数");
            if (hundred==ten){
                System.out.println("这个数"+number+"是回文");
           }else System.out.println("这个数" +number+"不是回文");
        }else {
            n=1;
            System.out.println("这是一个一位数");
        }

    }
}
